﻿using AutoMapper;
using BestEasyCMS.Model.Security;
using BestEasyCMS.Service.Views.Security;

namespace BestEasyCMS.Service
{
    public class BootStrapper
    {
        public static void ConfigureAutoMapper()
        {
            Mapper.CreateMap<User, UserView>().ForMember(p => p.RoleView, opt => opt.MapFrom(a => a.Role));
            Mapper.CreateMap<UserView, User>().ForMember(p => p.Role, opt => opt.MapFrom(a => a.RoleView));

            Mapper.CreateMap<Role, RoleView>();
            Mapper.CreateMap<RoleView, Role>();

            Mapper.CreateMap<Resource, ResourceView>();
            Mapper.CreateMap<ResourceView, Resource>();
        }
    }
}
